package com.findMe.controller;

import com.findMe.entity.Goods;
import com.findMe.entity.OneJacksonEntity;
import com.findMe.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(path = "goods")
public class GoodsController {

    @Autowired
    @Qualifier("GoodsService")
    private GoodsService goodsService;

    @Autowired
    @Qualifier("oneJacksonEntity")
    private OneJacksonEntity oneJacksonEntity;

    @GetMapping(path = "todayRecommend")
    public @ResponseBody OneJacksonEntity todayRecommend(){

        List<Goods> goodsList = goodsService.todayRecommend();

        oneJacksonEntity.setMsg("请求成功");
        oneJacksonEntity.setStatus(200);
        oneJacksonEntity.setData(goodsList);

        return oneJacksonEntity;
    }
}
